﻿@model WebShop.Contracts.Product

<div id="dvProductCart">
    <fieldset>
        <legend>Cart</legend>

        @using (Ajax.BeginForm("AddToCart", "Products", new AjaxOptions
        {
            HttpMethod = "GET",
            InsertionMode = InsertionMode.Replace,
            UpdateTargetId = "dvProductCart"
        }))
        {
            @Html.Hidden("id", Model.ProductID);
                                           
            <input type="text" name="quantity" value="1" />
            <input type="submit" name="cartAction" value="Add" />
        
            if (ViewBag.QuantityInCart > 0)
            {
                <input type="submit" name="cartAction" value="Remove" />
            }
            <p>
                There is <b>@ViewBag.QuantityInCart</b> items in the cart
            </p>
    
            @Html.ActionLink("View your cart", "Index", "ProductsCart");
        }
    </fieldset>
</div>
